package com.yin.myproject.netty.chapter06;

import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;

/**
 * @author Eason
 * @create 2017-12-30 0:46
 **/
public class TestStudent {

    public static void main(String[] args) throws Exception {
        Student st = new Student("Tom", 'M', 20, 3.6);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream os = new ObjectOutputStream(bos);
        os.writeObject(st);
        os.flush();
        os.close();
        byte[] b = bos.toByteArray();
        System.out.println("The jdk serializable length is : " + b.length);
        bos.close();
        System.out.println("==================================================");
        System.out.println("The byte array serializable length is : " + st.codeC().length);
    }
}
